
export let scriptNode: any;

export function loaderMap() {
    const AK = 'Skvyr88Fia3jCiKoL67EZskY4k6VjiAK';
    const BMap_Url = 'https://api.map.baidu.com/api?type=webgl&v=1.0&ak=' + AK + '&callback=onBMapCallback';
    
    
    return new Promise((resolve,reject) => {
      if(BMapGL){
        resolve(BMapGL);
        return true;
      }
      
      window.onBMapCallback = function(){
        resolve(BMapGL);
      }
      
      scriptNode = document.createElement("script");
      scriptNode.setAttribute("type",'text/javascript');
      scriptNode.setAttribute('src',BMap_Url);
      document.body.appendChild(scriptNode);
    })
}